<%@ page language="java" isELIgnored="false" import="java.util.*"
	pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>上传适配器</title>
<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script>
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css' rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/jsFile/fdc.js"></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/citylist.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>
<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/fare/css/form_style.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/wait/js/wait.js"></script>
<style>
	*{
		margin:0px ;padding:0px;
	}
	
	input,select{
		height:25px;
		border:1px #BDBDBD solid;
		margin-top:5px;
		margin-bottom:5px;
		font-size:15px;
	}
	textarea{
		border:1px #BDBDBD solid;
		margin-top:5px;
		margin-bottom:5px;
		font-size:15px;
	}
	.buttonCss{
		 background:#F0F0F0 repeat-x;
		 padding-top:3px;
		 border-top:1px solid #708090;
		 border-right:1px solid #708090;
		 border-bottom:1px solid #708090;
		 border-left:1px solid #708090;
		 width:150px;
		 height:auto;
		 font-size:10pt;
		 cursor:pointer;
		 text-align:center;
	} 
	#fileContainer_div{
		position:relative;
		background:yellow;
		padding:0px;
		margin:0px;
		width:450px;
	}
	#filePath_div{
		border:1px #BDBDBD solid;
		height:25px;
		width:300px;
		background:white;
		float:left;
		font-size:15px;
		overflow:hidden;
		line-height:25px;
	}
	#fileChooseBtn_div{
		border:1px #BDBDBD solid;
		height:25px;
		width:100px;
		cursor:pointer;
		background:white;
		font-size:18px;
		line-height:25px;
		float:left;
		margin-left:5px;
		text-align:center;
		position:relative;
	}
	
	#chooseMyFile_input{
		top:0px;
		position:absolute;
		left:0px;
		width:100%;
		filter:alpha(opacity=0);
		-moz-opacity:0;
		-khtml-opacity: 0;
		opacity: 0;
		cursor:pointer;
	}
	#fileUpBtn_div{
		border:1px #BDBDBD solid;
		margin-top:5px;
		margin-bottom:5px;
		font-size:18px;
		cursor:pointer;
		
	}
	#fileUpBtn_div:HOVER {
		background:#EBEBEB;
	}
</style>

<script type='text/javascript'>
	var PARENTWIN;
	$(function(){
		showMessage();
		//var obj=window.dialogArguments;//读取来自父窗口的数据
		//alert(window.parent);
		//PARENTWIN=obj.parent;
	});
	
	//选择文件后触发
	function chooseFile(e){
		var value=$(e).val();
		value=value.split("\\");
		if(value!=null || $.trim(value)!=""){
			$("#className_input").val(value[value.length-1]);
			$("#filePath_div").text($(e).val());
		}
	}
	function showMessage(){
		var val="${result}";
		switch(val){
		case "fail":
			alert("上传失败！请再次尝试或联系管理员");
			break;
		case "success":
			alert("上传适配器成功！");
			/* PARENTWIN.ajaxQuery(-1); */
			window.opener.ajaxQuery(-1);
			break;
		}
	}
	
	function a(){}
	
	function upLoadFile(){
		if(!$("#source_select").val()){
			alert("请选择正确的渠道！");
			return;
		}
		if(!$("#className_input").val()){
			alert("请选择正确的文件！");
			return;
		}
		if($("#enable_select").val()==""){
			alert("请选择状态！");
			return;
		}
		if($.trim($("#version_input").val())==""){
			alert("请填写版本号!");
			return;
		}
		if($("#chooseMyFile_input").val()=="" || !/\.class$/.test($("#chooseMyFile_input").val())){
			alert("请选择class文件！");
			return;
		}
		FDCWait.show();
		$("#fileUp_form").submit();
	}
	
</script>

</head>
<body>
<div class="main main_max" style="padding:0px;margin:0px;width:100%;width:700px;">
	<div class="form_body" style='width:100%;margin:0px;padding:0px;'>
		<div class="main_max" style='width:100%'>
			<div class="form_table_tltle">适配器上传</div>
			<form action="<%=request.getContextPath() %>/adaptorAction!upload.action" method="post" enctype="multipart/form-data" id='fileUp_form'>
			<table cellSpacing=0 cellPadding=0 width="100%" border=0 class="form_table">
				<tr>
					<td class="left">适用渠道</td>
					<td class="" style="width:450px;">
						<select name='vo.sourceID' style="width:150px;" id='source_select'>
							<c:forEach var="item" items="${sources}">
								<option value="${item.id}">${item.name}</option>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<td class="left">类名(默认)</td>
					<td class="" style="width:450px;">
						<input readonly='true' type='text' id='className_input'/>
					</td>
				</tr>
				<tr>
					<td class="left">状态</td>
					<td class="" style="width:450px;">
						<select name='vo.isenable' id='enable_select'>
							<option value='1'>可用</option>
							<option value='0'>不可用</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="left">版本号</td>
					<td class="" style="width:450px;">
						<input type='text' name='vo.version' id='version_input'/>
					</td>
				</tr>
				<tr>
					<td class="left">备注</td>
					<td class="" style="width:450px;">
						<!-- <input type='text' name='vo.remarks'/> -->
						<textarea rows="5" cols="40"  name='vo.remarks' ></textarea>
					</td>
				</tr>
				<tr>
					<td class="left">类文件</td>
					<td class="" style="width:450px;">
						<div id="fileContainer_div">
							<div id="filePath_div"></div>
							<div id='fileChooseBtn_div'>
								浏览
								<input type='file' id='chooseMyFile_input' 
								name='adapter' onchange="javascript:chooseFile(this)" />
							</div>
							
						</div>
					</td>
				</tr>
				
				<tr>
					<td colspan="2" style='text-align: center'>
						<div id='fileUpBtn_div' onclick='upLoadFile()'>上传</div>
					</td>
				</tr>
			</table>
			</form>
			
		</div>
	</div>
</div>


</body>
</html>

